ES modules(ES 模块):JavaScript 的标准模块系统,用于在不同文件/模块之间进行导入(import)与导出(export),实现代码的组织、复用与作用域隔离。常用于现代前端工程与 Node.js(在相应配置下)。也常简称为 ESM。
/ˌiː ˈes ˈmɑːdʒuːlz/
ES modules let you import code from another file.
ES 模块让你可以从另一个文件导入代码。
Because ES modules are loaded asynchronously in the browser, you may need to handle dependency order and use type="module" in your script tag.
由于浏览器中 ES 模块通常以异步方式加载,你可能需要处理依赖顺序,并在 <script> 标签中使用 type="module"。
ES 来自 ECMAScript(JavaScript 的标准化名称)。Modules 表示“模块”。ES 模块作为语言层面的标准模块机制在 ES2015(ES6) 中引入,提供 import/export 语法,用来替代或补充早期常见的非标准/环境特定方案(如 CommonJS、AMD)。